import {useContext, useEffect, useState} from "react";
import {MyContext} from "./MyContext";
const B = () => {
	const [themeClassName, setThemeClassName] = useState();
	const theme = useContext(MyContext);

	useEffect(() => {
		setThemeClassName(theme);
	}, [theme])

	return (
		<div className={themeClassName}>
			<h3>
				我是B组件,我从Demo组件中获取到主题是:
				{theme}
			</h3>

		</div>
	)
}

export default B;